// /!*=========================表单验证==============================*!/
//验证用户名
document.querySelector(".consumerEmail").onblur = checkUserEmail;
function  checkUserEmail(){
    //（1）获得用户名
    var consumerEmail = document.querySelector(".consumerEmail").value;
    console.log("用户名：" + consumerEmail);

    //(2)邮箱是否合格
    if(consumerEmail == "" || consumerEmail == null){// 是否为空
        //(3)消息提示
        document.querySelector(".consumerEmail-msg").innerText = "邮箱不能为空";
        return false;
    }else if( /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(consumerEmail) ){ //
        document.querySelector(".consumerEmail-msg").innerText = "邮箱未注册";
        return false;
    }else{
        document.querySelector(".consumerEmail-msg").innerText = "";
        return true;
    }

}
//验证密码
document.querySelector(".password").onblur = checkPassword;
function  checkPassword(){
    var password = document.querySelector(".password").value;
    if(password == "" || password == null){// 是否为空
        //(3)消息提示
        document.querySelector(".password-msg").innerText = "验证码不能为空";
        return false;
    }else if( /^\d{n}$/.test(password) ){
        document.querySelector(".password-msg").innerText = "验证码不正确";
        return false;
    }else{
        document.querySelector(".password-msg").innerText = "";
        return true;
    }
}
//提交表单，验证
document.querySelector(".moco-btn").onclick= function (){

    if(checkUserEmail()  && checkPassword() ){


    };

}